﻿
@{
    ViewBag.Title = "FactoryRisk";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}


@section css{
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <style>
        .required {
            color: red;
        }

        .bg-light th {
            font-weight: bolder;
            text-align: center;
        }
    </style>
}


<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>作业活动风险</a>
            </li>
            <li class="crumb-trail">风险分级管控</li>
        </ol>
    </div>
</header>


<section id="content" class="animated fadeIn" ng-cloak ng-controller="RiskController" ng-init="SearchModel={};LoadingMsg='正在加载';page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     PageName='@Request.CurrentExecutionFilePath.Substring(Request.CurrentExecutionFilePath.LastIndexOf("/") + 1)';
     SearchModel={};
         AddModel={};
     SearchModel.CurrentYear='@DateTime.Now.Year';
    GetRiskList(SearchModel,page);
         GetRiskLevelChart();
         GetAfterRiskLevelChart();
         GetChartByActive();
         ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg">{{LoadingMsg}}</div>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="panel panel-info">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-list"></span>风险作业统计分析
                </span>
                <div class="widget-menu pull-right mr10">

                </div>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-4" id="chart1" style="height:200px;"></div>
                    <div class="col-lg-4" id="chart2" style="height:200px;"></div>
                    <div class="col-lg-4" id="chart3" style="height:200px;"></div>
                </div>

            </div>
        </div>
        <div class="panel panel-info">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-list"></span>作业活动风险列表 总数:{{result.totalItemCount}}
                </span>
                <div class="widget-menu pull-right mr10">
                    <div class="btn-group">
                        <a href="#AddModal" ng-click="InitAddForm(AddModel); BindDepartmentList('Dep_Select');" data-toggle="modal" class="btn btn-xs btn-default  light ">
                            <i class="fa fa-plus"></i>添加作业活动风险
                        </a>
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                        <tr class="bg-light">
                            <th>序号</th>
                            <th>作业单元名称</th>
                            <th>作业活动</th>
                            <th>危险有害因素</th>
                            <th>固有风险等级</th>
                            <th>控制风险等级</th>
                            <th>管控措施</th>
                            <th>责任部门</th>
                            <th>责任人</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-show="RiskList.length==0 && !PageLoading">
                            <td colspan="18" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                        </tr>
                        <tr ng-repeat="x in RiskList">
                            <td style="text-align: center; width: 5%;">
                                <span>{{((result.currentPage-1)*20)+($index+1)}}</span>
                            </td>
                            <td style="text-align:center;width:5%;" ng-bind="x.UnitName"></td>
                            <td style="text-align: center; width: 5%;" ng-bind="x.WorkContent"></td>
                            <td style="text-align: center; width: 15%;" ng-bind="x.RiskFactor"></td>
                            <td style="text-align: center; width: 5%;" ng-bind="x.RiskLevel"></td>
                            <td style="text-align: center; width: 5%;" ng-bind="x.AfterLevel"></td>
                            <td style="text-align: center; width: 25%;" ng-bind="x.Solution"></td>
                            <td style="text-align: center; width: 5%;" ng-bind="x.ResponsibleDep"></td>
                            <td style="text-align: center; width: 5%;" ng-bind="x.Responsible"></td>
                            <td style="text-align: center; width: 6%;">
                                <a href="#EditModal" ng-click="ShowDetail(x);BindDepartmentList('Dep_Select2',x.ResponsibleDep);" data-toggle="modal" class="btn btn-xs btn-warning light">
                                    <i class="fa fa-pencil"></i>编辑
                                </a>
                                <a ng-click="DeleteActiveRisk(x.Id,SearchModel,result.currentPage);"  class="btn btn-xs btn-danger light ">
                                    <i class="fa fa-trash"></i>删除
                                </a>
                            </td>
                        </tr>
                    </tbody>
                </table>

            </div>

        </div>
        <div class="text-center" ng-show="RiskList!=null && RiskList.length>0">
            <ul class="pagination  justify-content-center">
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetRiskList(SearchModel,1);">首页</a></li>
                <li class="page-item" ng-class="{'active':result.currentPage==page}" ng-repeat="page in result.pages"><a style="cursor:pointer;" ng-click="GetRiskList(SearchModel,page)" class="page-link" ng-bind="page"></a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetRiskList(SearchModel,(result.currentPage + 1 > result.totalPage ? result.totalPage : result.currentPage + 1))">下一页</a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetRiskList(SearchModel,result.totalPage);">尾页</a></li>
            </ul>
        </div>
    </form>

    <div class="modal fade" id="AddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">添加作业活动风险</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">作业单元名称：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.UnitName">
                            </div>
                            <label class="col-lg-2 control-label">作业活动：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.WorkContent">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">固有风险等级：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.RiskLevel">
                            </div>
                            <label class="col-lg-2 control-label">控制风险等级：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.AfterLevel">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">危险有害因素：</label>
                            <div class="col-lg-8">
                                <textarea type="text" class="form-control" rows="5" ng-model="AddModel.RiskFactor"></textarea>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">管控措施：</label>
                            <div class="col-lg-8">
                                <textarea type="text" class="form-control" rows="5" ng-model="AddModel.Solution"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">责任部门：</label>
                            <div class="col-lg-3">
                                <select id="Dep_Select" class="form-control" ng-model="AddModel.ResponsibleDep">
                                    <option value="">所有部门</option>
                                    <option ng-repeat="x in DepartmentList" value="{{x.DepartmentName}}">{{x.DepartmentName}}</option>
                                </select>
                            </div>
                            <label class="col-lg-2 control-label">责任人：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="AddModel.Responsible">
                            </div>
                        </div>

                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="AddActiveRisk(AddModel,SearchModel);">保存</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">添加作业活动风险</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">作业单元名称：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="EditModel.UnitName">
                            </div>
                            <label class="col-lg-2 control-label">作业活动：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="EditModel.WorkContent">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">固有风险等级：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="EditModel.RiskLevel">
                            </div>
                            <label class="col-lg-2 control-label">控制风险等级：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="EditModel.AfterLevel">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">危险有害因素：</label>
                            <div class="col-lg-8">
                                <textarea type="text" class="form-control" rows="5" ng-model="EditModel.RiskFactor"></textarea>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">管控措施：</label>
                            <div class="col-lg-8">
                                <textarea type="text" class="form-control" rows="5" ng-model="EditModel.Solution"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">责任部门：</label>
                            <div class="col-lg-3">
                                <select id="Dep_Select2" class="form-control" ng-model="EditModel.ResponsibleDep">
                                    <option value="">所有部门</option>
                                    <option ng-repeat="x in DepartmentList" value="{{x.DepartmentName}}">{{x.DepartmentName}}</option>
                                </select>
                            </div>
                            <label class="col-lg-2 control-label">责任人：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="EditModel.Responsible">
                            </div>
                        </div>

                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close2">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="UpdateActiveRisk(EditModel,SearchModel,result.currentPage);">保存</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</section>

@section Js{
    <script src="~/Bussiness/js/libs/echarts.min.js"></script>
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/Risk.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script>

    </script>
}

